package com.gs.netty.core.resolver;


import org.springframework.beans.factory.InitializingBean;

/**
 * 抽象的异常处理解析器
 * @param <Request>
 * @param <Response>
 */

public abstract class AbstractHandlerExceptionResolver <Request,Response>

        implements HandlerExceptionResolver<Request,Response>,
        InitializingBean {


    @Override
    public void resolveException(Request request, Response response, Object handler, Exception ex) {
        // 校验是否对这个这个请求类型是否支持

           doResolveException(request, response, handler, ex);

    }

   protected abstract void doResolveException(Request request, Response response, Object handler, Exception ex);

    protected abstract void initArgumentResolvers();
    protected  abstract void initReturnValueHandlers();

    protected abstract void initExceptionHandlerAdviceCache();

    @Override
    public void afterPropertiesSet() throws Exception {
        initArgumentResolvers();
        initReturnValueHandlers();
        initExceptionHandlerAdviceCache();
    }
}
